package pikes.ecma;

import java.util.LinkedList;

public class Block extends PrintableSourceElement implements Statement {

	private LinkedList<Statement> statements = new LinkedList<Statement>();

	public void add(final Statement statement) {
		if (statement != null) {
			statements.add(statement);
		}
	}

	public void visit(final SyntaxTreeVisitor syntaxTreeVisitor) throws EcmaSyntaxVisitingException {
		syntaxTreeVisitor.openCurlyBrace();
		for (Statement statement : statements) {
			statement.visit(syntaxTreeVisitor);
		}
		syntaxTreeVisitor.closeCurlyBrace();
	}

}
